package org.example.service;

import com.mysql.cj.Session;
import org.example.dao.BookDao;
import org.example.dao.MessageDao;
import org.example.javabean.*;


import javax.servlet.http.HttpSession;
import java.util.List;

public class MessageService {
    private MessageDao messageDao = new MessageDao();



    public int insertMessage(HttpSession session,String message) {

        return messageDao.insertMessage(session.getAttribute("username").toString(),message);
    }
    public List<Message> searchAllMessage(int pageNum, int pageSize) {

        List<Message> messages = messageDao.selectAllMessage(pageNum, pageSize);

        return messages;
    }

    public int selectMessageCount() {

        return messageDao.selectMessageCount();
    }



}
